package ollama

import (
	"net/http"
	"net/url"

	"gitee.com/mkwchecking/sr-admin/apps/knowledge/conf"
	"github.com/ollama/ollama/api"
)

func NewProxy() (*Proxy, error) {

	llm := &Proxy{}
	if endpoint, _ := url.Parse(conf.Conf.Ollama.Addr); endpoint != nil {
		llm.cli = api.NewClient(endpoint, http.DefaultClient)
	}

	return llm, nil
}

// OllamaProxy is a client for the Ollama API.
type Proxy struct {
	cli *api.Client
}

func (p *Proxy) Client() *api.Client {
	return p.cli
}
